package ahblue.cn.tanzi.valid;

import android.app.Activity;
import android.content.Context;

import ahblue.cn.tanzi.cache.interceptor.action.Valid;
import ahblue.cn.tanzi.model.user.LoginResultModel;
import ahblue.cn.tanzi.ui.person.LoginActivity;


/**
 * 登录验证
 */
public class LoginValid implements Valid {
    private Context context;

    public LoginValid(Context context) {
        this.context = context;
    }

    /**
     * check whether it login in or not
     * @return
     */
    @Override
    public boolean check() {
        return LoginResultModel.checkUserInfoExist(context);
    }


    /**
     * if check() return false. then doValid was called
     */
    @Override
    public void doValid() {
        LoginActivity.into((Activity) context);
    }
}